<?php

/**
 * PersonaDetalle filter form base class.
 *
 * @package    sibi-salud
 * @subpackage filter
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BasePersonaDetalleFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'persona_id'       => new sfWidgetFormPropelChoice(array('model' => 'Persona', 'add_empty' => true)),
      'localidad_id'     => new sfWidgetFormPropelChoice(array('model' => 'Localidad', 'add_empty' => true)),
      'lugar_nacimiento' => new sfWidgetFormFilterInput(),
      'celular'          => new sfWidgetFormFilterInput(),
      'estrato'          => new sfWidgetFormFilterInput(),
      'rh_id'            => new sfWidgetFormPropelChoice(array('model' => 'Rh', 'add_empty' => true)),
      'genero'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'estado_civil_id'  => new sfWidgetFormPropelChoice(array('model' => 'EstadoCivil', 'add_empty' => true)),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'persona_id'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Persona', 'column' => 'id')),
      'localidad_id'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Localidad', 'column' => 'id')),
      'lugar_nacimiento' => new sfValidatorPass(array('required' => false)),
      'celular'          => new sfValidatorPass(array('required' => false)),
      'estrato'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'rh_id'            => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Rh', 'column' => 'id')),
      'genero'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'estado_civil_id'  => new sfValidatorPropelChoice(array('required' => false, 'model' => 'EstadoCivil', 'column' => 'id')),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('persona_detalle_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'PersonaDetalle';
  }

  public function getFields()
  {
    return array(
      'persona_id'       => 'ForeignKey',
      'localidad_id'     => 'ForeignKey',
      'lugar_nacimiento' => 'Text',
      'celular'          => 'Text',
      'estrato'          => 'Number',
      'rh_id'            => 'ForeignKey',
      'genero'           => 'Boolean',
      'estado_civil_id'  => 'ForeignKey',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'id'               => 'Number',
    );
  }
}
